import hockeystreams

# xbmc-hockey-streams
# author: craig mcnicholas
# contact: craig@designdotworks.co.uk

print '# XBMC Hockey Streams Unit Tests #'
print 'I need some information before running these tests!'

# Get username and password
username = raw_input("Username: ")
password = raw_input("Password: ")

# Test logging in
token = hockeystreams.login(username, password)

print "Token: " + token

# Test retrieving the available archived game dates
dates = hockeystreams.availableDates(username, token)

print "Available Dates: " + ', '.join(map(str, dates))

# Test retrieving a single dates events
events = hockeystreams.eventsForDate(username, token, dates[100])

print "Events: " + '\n'.join(map(str, events))

# Test retrieving an events stream url
stream = hockeystreams.eventStream(username, token, events[0])

print "Stream: " + stream

# Test retrieving teams
teams = hockeystreams.teams(username, token)

print "Teams: " + ', '.join(map(str, teams))

# Test retrieving events for a team

events = hockeystreams.eventsForTeam(username, token, teams[20].url)

print "Events: " + '\n'.join(map(str, events))

# Test retrieving future and live events

liveOrFuture = hockeystreams.liveEvents(username, token)

print "Live/Future: " + '\n'.join(map(str, liveOrFuture))

# Test retrieving stream url if available
if len(liveOrFuture) > 0:
    for event in liveOrFuture:
        if event.isLive:
            stream = hockeystreams.eventStream(username, token, event)
            print "Stream: " + (stream if stream != None else 'None')
